Description
@suplink/jssdk provides a series of SDKs which you can use to develop custom applications.
Applications used these SDKs must be running on supLink mobile.
Usage
- Install denpendency
npm install @suplink/jssdk -S
- Example
- Full import
import suplink from '@suplink/jssdk';
suplink.getSystemInfo().then((res) => console.log(res)) - Import as needed
import { getSystemInfo } from '@suplink/jssdk';
getSystemInfo().then((res) => console.log(res)) - Import online resources
// latest version of online resource
<script src="https://devc.supos.com/suplink/jssdk/scripts/jssdk.min.js"></script>
// specified version of online resource (jssdk-{version}.min.js)
<script src="https://devc.supos.com/suplink/jssdk/scripts/jssdk-1.2.13.min.js"></script>
<script type="text/javascript">
window.suplink.getSystemInfo().then((res) => console.log(res))
</script>
SDK Details-Basic
getEnvInfo
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | Object | Response data |
| data.suplink | boolean | Whether it is running on supLink |
| data.iframe | boolean | Whether it is running on iframe |
import { getEnvInfo } from '@suplink/jssdk';
getEnvInfo().then((res) => console.log(res))
getSystemInfo
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | Data | Response data |
| Attribute | Type | Description | APP Version |
|---|---|---|---|
| brand | string | Device brand (e.g., HUAWEI, XIAOMI, iOS: Apple) | |
| currentBattery | string | Device battery level | |
| language | string | User's preferred language | |
| model | string | Phone model | |
| pixelRatio | number | Device pixel ratio (1 for Android. For iOS, it represents screen width pixels / screen width points.) | |
| pixelWidth | number | Device pixel width (For Android, it represents the width of the screen including virtual keys. For iOS, it represents the physical screen width in pixels, e.g., 1080.) | |
| pixelHeight | number | Device pixel height (For Android, it represents the height of the screen including virtual keys. For iOS, it represents the physical screen height in pixels, e.g., 1920.) | |
| platform | string | Operating system name: Android, iOS | |
| storage | string | Device disk size | |
| system | string | Operating system version number | |
| statusBarHeight | number | Status bar height (This value is in points. For pixel value, please multiply it with the pixel ratio.) | |
| navigationBarHeight | number | Navigation bar height (This value is in points. For pixel value, please multiply it with the pixel ratio.) | |
| webSource | number | WebView opening method (0: Open normally from the homepage, 1: Open from im, 2: Open with jsapi) | |
| deviceId | string | Unique device identifier | |
| appVersion | string | suplinkAPP version | 3.3.0 |
| suposServerVersion | string | supos backend version | 3.4.0 |
| suplinkServerVersion | string | suplink backend version | 3.4.0 |
| easyMode | boolean | Easy Mode | 4.3.0 |
| highPerformance | boolean | High Performance Mode | 4.3.0 |
| darkMode | boolean | Dark Mode | 4.3.0 |
currentBattery, storage and statusBarHeight are unavailable in h5.
import { getSystemInfo } from '@suplink/jssdk';
getSystemInfo().then((res) => console.log(res))
renderFinish
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | unknown | Response data |
import { renderFinish } from '@suplink/jssdk';
renderFinish().then((res) => console.log(res))
SDK Details-Device
biometrics
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | unknown | Response data |
import { biometrics } from '@suplink/jssdk';
biometrics().then((res) => console.log(res))
compass
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | unknown | Response data |
import { compass } from '@suplink/jssdk';
compass().then((res) => console.log(res))
connectPrinter
| Attribute | Type | Description | Required |
|---|---|---|---|
| mode | number | Connection mode: 0 for Bluetooth connection, 1 for WiFi connection | Yes |
| host | string | Host address (IP + port) for WiFi printing | No |
| mac | string | MAC address of the printer for Bluetooth printing | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | unknown | Response data |
import { connectPrinter } from '@suplink/jssdk';
connectPrinter({ mode:1, host: '127.0.0.1:2020' }).then((res) => console.log(res))
disconnectPrinter
- Only Zebra printer is supported.
- APP version must be v3.7.0 and later.
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | unknown | Response data |
import { disconnectPrinter } from '@suplink/jssdk';
disconnectPrinter().then((res) => console.log(res))
flashlight
| Attribute | Type | Description | Required |
|---|---|---|---|
| open | boolean | Whether to turn on the flashlight. | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | 200: Success | 404: Failure |
| msg | string | Response information |
| data | unknown | Response data |
import { flashlight } from '@suplink/jssdk';
flashlight({ open: true }).then((res) => console.log(res))
gesture
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for successful gesture verification, 300 for user canceling gesture verification, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { gesture } from '@suplink/jssdk';
gesture().then((res) => console.log(res))
getBluetoothPairedDevices
- Only Android is supported.
- APP version must be v3.7.0 and later.
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.list | Array.<Device> | Response data list containing Device objects |
| Attribute | Type | Description |
|---|---|---|
| name | string | Device name |
| address | string | Device address used for sending print commands |
import { getBluetoothPairedDevices } from '@suplink/jssdk';
getBluetoothPairedDevices().then((res) => console.log(res))
getNetworkInfo
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.networkAvailable | boolean | Indicates whether the network is available |
| data.networkType | string | Value representing the network type |
import { getNetworkInfo } from '@suplink/jssdk';
getNetworkInfo().then((res) => console.log(res))
makePhoneCall
| Attribute | Type | Description | Required |
|---|---|---|---|
| phoneNumber | number or string | User's phone number | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { makePhoneCall } from '@suplink/jssdk';
makePhoneCall({ phoneNumber: 110 }).then((res) => console.log(res))
nfc
| Attribute | Type | Description | Default | Required |
|---|---|---|---|---|
| type | number | NFC usage type: 0 for NFC verification, 1 for reading NFC data and returning it | 0 | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | string | Response data. If the data reading function is called, it returns specific data. |
import { nfc } from '@suplink/jssdk';
nfc({ type: 0 }).then((res) => console.log(res))
ocr
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | string | Response data |
import { ocr } from '@suplink/jssdk';
ocr().then((res) => console.log(res))
oncePrint
- Only Zebra printer and Android system are supported.
- APP version must be v3.7.0 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| mode | number | Connection mode: 0 for Bluetooth connection, 1 for WiFi connection | Yes |
| content | string | Print content. If using CPCL language, newline must end with \n | Yes |
| host | string | Host address (IP + port) for WiFi printing | No |
| mac | string | MAC address of the printer for Bluetooth printing | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { oncePrint } from '@suplink/jssdk';
oncePrint({ mode: 0, content: '123', host: '127.0.0.1:22' }).then((res) => console.log(res))
print
- Only Zebra printer and Android system are supported.
- APP version must be v3.7.0 and later.
- The connection does not automatically disconnect after printing, unless disconnectPrinter is used.
| Attribute | Type | Description | Required |
|---|---|---|---|
| content | string | Print content. If using CPCL language, newline must end with \n | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { print } from '@suplink/jssdk';
print({ content: '123' }).then((res) => console.log(res))
scanCode
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { scanCode } from '@suplink/jssdk';
scanCode().then((res) => console.log(res))
scanner
- Only Android is supported.
- APP version must be v3.1.0 and later.
- Manually set broadcast on Android. Name: com.bluetron.suplink.login, key: loginData.
| Attribute | Type | Description | Required |
|---|---|---|---|
| outputMode | number | Data output mode: 0 for return data mode (requires passing a second argument) | 1 for keyboard mode, directly filling the focused input box. Some devices may not support this mode. | No |
| success | function | Callback function to receive scanner data | No |
success({
code: 200, // response code. 200: success | 404: failed
msg: '', // response message
data: '', // scanned data
})
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { scanner } from '@suplink/jssdk';
scanner({ outputMode: 1 }).then((res) => console.log(res))
setScreenOrientation
| Attribute | Type | Description | Required |
|---|---|---|---|
| mode | string | Rotation mode: 'auto' for automatic orientation | 'landscape' for landscape orientation | 'portrait' for portrait orientation | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { setScreenOrientation } from '@suplink/jssdk';
setScreenOrientation({ mode: 'auto' }).then((res) => console.log(res))
startContinuousScan
APP version must be v3.7.0 and later.
| Attribute | Type | Description | Default | Required | APP Version |
|---|---|---|---|---|---|
| interval | number | Scanning time interval in milliseconds. Minimum value is 1000ms. | 1000 | No | |
| vibrate | boolean | Whether to enable vibration | false | No | 4.1.0 |
| position | position | Scanner position: 0 for top, 1 for middle | 0 | No | 4.6.0 |
| success | function | Callback function to receive scan data | Yes |
success({
code: 200, // response code. 200: success | 404: failed
msg: '', // response message
data: '', // scanned data
})
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { startContinuousScan } from '@suplink/jssdk';
startContinuousScan({ success: (result) => console.log(result) }).then((res) => console.log(res))
stopContinuousScan
- Only Android is supported.
- APP version must be v3.7.0 and later.
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { stopContinuousScan } from '@suplink/jssdk';
stopContinuousScan().then((res) => console.log(res))
vibrate
APP version must be v4.1.0 and later.
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { vibrate } from '@suplink/jssdk';
vibrate().then((res) => console.log(res))
SDK Details-Event
offPageHide
When passing a listener, only the corresponding hidden event for that listener is canceled; otherwise, all page hidden events are canceled.
| Attribute | Type | Description | Required |
|---|---|---|---|
| listener | function | Event listener function | No |
import { offPageHide } from '@suplink/jssdk';
offPageHide()
offPageShow
When passing a listener, only the corresponding visible event for that listener is canceled; otherwise, all page visible events are canceled.
| Attribute | Type | Description | Required |
|---|---|---|---|
| listener | function | Event listener function | No |
import { offPageShow } from '@suplink/jssdk';
offPageShow()
onAppHide
- Only Android is supported.
- APP version must be v4.0.2 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| listener | function | Event listener function | Yes |
import { onAppHide } from '@suplink/jssdk';
onAppHide({ listener: () => console.log('hide') })
onAppShow
- Only Android is supported.
- APP version must be v4.0.2 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| listener | function | Event listener function | Yes |
import { onAppShow } from '@suplink/jssdk';
onAppShow({ listener: () => console.log('show') })
onPageHide
| Attribute | Type | Description | Required |
|---|---|---|---|
| listener | function | Event listener function | Yes |
import { onPageHide } from '@suplink/jssdk';
onPageHide({ listener: () => console.log('hide') })
onPageShow
| Attribute | Type | Description | Required |
|---|---|---|---|
| listener | function | Event listener function | Yes |
import { onPageShow } from '@suplink/jssdk';
onPageShow({ listener: () => console.log('show') })
SDK Details-File
fileConverter
APP version must be v4.3.0 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| target | string | Converted file type: 'pdf' for PDF files | Yes |
| urls | Array.<string> | List of file URLs to be converted | Yes |
| days | number | Storage duration in days.
| No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.files | Array.<File> | List of converted files |
| Attribute | Type | Description |
|---|---|---|
| previewUrl | string | File preview URL |
| sourceFileUrl | string | File address |
| size | string | File size |
import { fileConverter } from '@suplink/jssdk';
fileConverter({ target: 'pdf', urls: ['http://127.0.0.1/test.xls'] }).then((res) => console.log(res))
previewFile
Images, videos and PDF files are supported for preview.
| Attribute | Type | Description | Required |
|---|---|---|---|
| url | string | Complete path of the file to be previewed | Yes |
| title | string | Name of the file to be previewed | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { previewFile } from '@suplink/jssdk';
previewFile({ url: 'http://127.0.0.1/img/test.png' }).then((res) => console.log(res))
SDK Details-Position
getLocation
APP version must be v4.3.0 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| inverseEnabled | boolean | Enable reverse geocoding to obtain more formatted information. info Reverse geocoding requires an internet connection. | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Data | Response data |
| Attribute | Type | Description |
|---|---|---|
| longitude | number | Longitude |
| latitude | number | Latitude |
| horizontalAccuracy | number | Horizontal accuracy, unit: meters |
| formattedAddress | string | Formatted address (requires inverseEnabled=true) |
| country | string | Country (requires inverseEnabled=true) |
| province | string | Province/Direct-controlled Municipality (requires inverseEnabled=true) |
| city | string | City (requires inverseEnabled=true) |
| citycode | string | City code (requires inverseEnabled=true) |
| district | string | District/County (requires inverseEnabled=true) |
| adcode | string | Area code (requires inverseEnabled=true) |
| street | string | Street name (requires inverseEnabled=true) |
| number | string | House number (requires inverseEnabled=true) |
| POIName | string | Point of Interest (POI) name (requires inverseEnabled=true) |
| AOIName | string | Area of Interest (AOI) name (requires inverseEnabled=true) |
import { getLocation } from '@suplink/jssdk';
getLocation().then((res) => console.log(res))
startLocationUpdate
| Attribute | Type | Description | Required |
|---|---|---|---|
| success | function | Callback function to get real-time location data | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
success({
code: 200, // response code. 200: success | 404: failed
msg: '', // response message
data: {
longitude: '',
latitude: '',
horizontalAccuracy: '', // unit: m
},
})
import { startLocationUpdate } from '@suplink/jssdk';
startLocationUpdate({ success: (result) => console.log(result) }).then((res) => console.log(res))
stopLocationUpdate
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { stopLocationUpdate } from '@suplink/jssdk';
stopLocationUpdate().then((res) => console.log(res))
SDK Details-Media
playVoiceByText
APP version must be v4.3.0 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| text | string | Text to be converted | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Data | Response data |
import { playVoiceByText } from '@suplink/jssdk';
playVoiceByText({ text: 'Hello' }).then((res) => console.log(res))
previewImage
- APP version must be v4.4.0 and later.
- Switching preview between multiple images is available.
| Attribute | Type | Description | Required |
|---|---|---|---|
| urls | Array.<string> | Complete paths of the images | Yes |
| index | number | Current index of the image being displayed | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Data | Response data |
import { previewImage } from '@suplink/jssdk';
previewImage({ urls: ['http://127.0.0.1/img/test.png'] }).then((res) => console.log(res))
record
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.voiceUrl | string | Path to the audio recording file |
import { record } from '@suplink/jssdk';
record().then((res) => console.log(res))
SDK Details-Redirection
exitMiniProgram
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Unknown | Response data |
import { exitMiniProgram } from '@suplink/jssdk';
exitMiniProgram().then((res) => console.log(res))
launchApp
APP version must be v3.1.0 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| android | string | Schema URL or package name for the Android app | Yes |
| ios | string | Schema URL for the iOS app | Yes |
| message | string | Error message when app launch is not successful | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Unknown | Response data |
import { launchApp } from '@suplink/jssdk';
launchApp({ android: 'suplink', ios: 'schemaDemo://' }).then((res) => console.log(res))
launchBaseMiniProgram
| Attribute | Type | Description | Required |
|---|---|---|---|
| name | string | Basic mini program name: alarm/trend | Yes |
| config | Alarm | Trend | Configuration options | Yes |
| Attribute | Type | Description | Required |
|---|---|---|---|
| pageType | string | Page type: list for alarm list page | Yes |
| objName | string | Object name of the tag, required when pageType=list | No |
| propName | string | Property name of the tag, required when pageType=list | No |
| Attribute | Type | Description | Required |
|---|---|---|---|
| pageType | string | Page type: detail for trend detail page | Yes |
| objName | string | Object name of the tag, required when pageType=detail | No |
| propName | string | Property name of the tag, required when pageType=detail | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Unknown | Response data |
import { launchBaseMiniProgram } from '@suplink/jssdk';
launchBaseMiniProgram({
name: 'trend',
config: {
pageType: 'detail',
objName: 'test',
propName: 'testTAG0'
}
}).then((res) => console.log(res))
launchMiniProgram
| Attribute | Type | Description | Required |
|---|---|---|---|
| appId | string | supLink mini program's appId | Yes |
| url | string | Complete URL path of the mini program | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Unknown | Response data |
import { launchMiniProgram } from '@suplink/jssdk';
launchMiniProgram({ appId: 'abcd', url: 'www.baidu.com' }).then((res) => console.log(res))
SDK Details-Network
upload
APP version must be v3.1.4 and later.
| Attribute | Type | Description | Default | Required | APP Version |
|---|---|---|---|---|---|
| type | number | (Deprecated, use mode) Upload method: 0 for album and shooting, 1 for files, 2 for all | 2 | No | |
| mode | number or Array.<number> | Upload method, takes priority over type. 0 for album, 1 for shooting, 2 for files | No | 3.9.0 | |
| max | number | Maximum number of selections, negative number means no limit | 9 | No | 3.3.0 |
| mediaType | number | Media types supported in the album, 0 for Photo + Video, 1 for Photo, 2 for Video | 0 | No | |
| days | number | Storage duration in days.
| 0 | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.files | Array.<Object> | List of uploaded files |
| data.files[].previewUrl | string | Processed file preview path (e.g., compressed, cropped, format conversion, etc.) |
| data.files[].sourceFileUrl | string | File source path |
| data.files[].size | number | File size in bytes |
import { upload } from '@suplink/jssdk';
upload({ mode: 0 }).then((res) => console.log(res))
SDK Details-Open SDK
departmentSelector
| Attribute | Type | Description | Required |
|---|---|---|---|
| title | string | Selector title | No |
| max | number | Maximum number of selections allowed. If not passed or set to 0, it means unlimited. | No |
| selected | Array.<string> | Array of UUIDs of selected departments | No |
| selectedCode | Array.<string> | Array of codes of selected departments | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Array.<Department> | Response data |
| Attribute | Type | Description |
|---|---|---|
| uuid | string | Department unique ID |
| showName | string | Department name |
| description | string | Department description |
| name | string | supOS current department number |
| parent | string | supOS parent department number |
| personsCount | string | Number of employees in the department |
| layNo | string | Department hierarchy |
| code | string | Department code |
import { departmentSelector } from '@suplink/jssdk';
departmentSelector().then((res) => console.log(res))
employeeSelector
| Attribute | Type | Description | Default | Required |
|---|---|---|---|---|
| type | number | Selector type: 1 for selecting without organizational structure, 2 for selecting with organizational structure | 1 | No |
| title | string | Selector title | empoyee selector | No |
| max | number | Maximum number of selections allowed. If not passed or set to 0, it means unlimited. | No | |
| selected | Array.<string> | Array of staffCodes of selected personnel | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Array.<Employee> | Response data |
| Attribute | Type | Description |
|---|---|---|
| staffCode | string | Employee unique ID |
| phone | string | Phone number |
| staffName | string | Employee name |
| timeZone | string | Time zone |
| string | Email address | |
| username | string | Account name |
| gender | string | Gender: 0 for female, 1 for male |
| portrail | string | Profile picture |
| imUserJid | string | Corresponding IM account |
| depts | string | Department list |
| userId | number | Employee ID |
import { employeeSelector } from '@suplink/jssdk';
employeeSelector().then((res) => console.log(res))
getLoginInfo
| Attribute | Type | Description | Default | Required |
|---|---|---|---|---|
| type | number | Selector type: 1 for selecting without organizational structure, 2 for selecting with organizational structure | 1 | No |
| title | string | Selector title | empoyee selector | No |
| max | number | Maximum number of selections allowed. If not passed or set to 0, it means unlimited. | No | |
| selected | Array.<string> | Array of staffCodes of selected personnel | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Data | Response data |
| Attribute | Type | Description |
|---|---|---|
| token | number | suplink's token |
| userName | number | Username |
| appId | number | Application ID |
| baseUrl | number | - |
| appName | number | Application name |
| suposToken | number | supOS token |
For web apps, baseUrl is not available.
import { getLoginInfo } from '@suplink/jssdk';
getLoginInfo().then((res) => console.log(res))
getStepCount
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.todayStepCount | number | Today's step count |
import { getStepCount } from '@suplink/jssdk';
getStepCount().then((res) => console.log(res))
getUserInfo
App version must V3.1.4 and later.
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Data | Response data |
| Attribute | Type | Description | APP Version |
|---|---|---|---|
| supLinkToken | string | supLink's Token | |
| suposToken | string | supOS's Token | |
| suposTenantId | string | supOS tenant ID info Unavailable for web apps. | |
| suposTenantDns | string | supOS tenant address | 4.1.0 |
| userId | number | User ID | |
| userCode | string | Unique identifier for the user | |
| username | string | Username | |
| staffCode | string | Unique identifier for the staff | |
| staffName | string | Staff name | |
| gender | number | Gender: 0 for female, 1 for male | |
| string | Email address | ||
| phone | string | Phone number | |
| portrail | string | Profile picture | |
| depts | Array.<string> | List of departments | |
| imUserJid | string | IM account | |
| timeZone | string | Time zone information | |
| userType | number | User type | 3.9.0 |
import { getUserInfo } from '@suplink/jssdk';
getUserInfo().then((res) => console.log(res))
openUserInfo
App version must V3.7.0 and later.
| Attribute | Type | Description | Required |
|---|---|---|---|
| staffCode | string | Unique identifier for the staff | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Unknown | Response data |
import { openUserInfo } from '@suplink/jssdk';
openUserInfo({ staffCode: '001' }).then((res) => console.log(res))
signature
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | Object | Response data |
| data.imageBase64 | number | Electronic signature Base64 |
import { signature } from '@suplink/jssdk';
signature().then((res) => console.log(res))
SDK Details-Data Cache
getStorage
| Attribute | Type | Description | Required |
|---|---|---|---|
| key | string | Key specified in the local storage | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | any | Data from local storage |
import { getStorage } from '@suplink/jssdk';
getStorage({ key: 'name' }).then((res) => console.log(res))
setStorage
| Attribute | Type | Description | Required |
|---|---|---|---|
| key | string | Key specified in the local storage | Yes |
| value | string | Value to be stored | Yes |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { setStorage } from '@suplink/jssdk';
setStorage({ key: 'name', value: 'bob' }).then((res) => console.log(res))
SDK Details-Interface
datePicker
App version must V3.3.0 and later.
| Attribute | Type | Description | Default | Required |
|---|---|---|---|---|
| title | string | Title | No | |
| min | number | Minimum selectable date in milliseconds | 0 | No |
| max | number | Maximum selectable date in milliseconds | 2556028800000 | No |
| value | number | Selected date in milliseconds | No | |
| showTime | boolean | Add time selection feature | true | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure, 300 for cancel |
| msg | string | Response information |
| data | number | Selected date |
import { datePicker } from '@suplink/jssdk';
datePicker().then((res) => console.log(res))
dateRangePicker
App version must V3.3.0 and later.
| Attribute | Type | Description | Default | Required |
|---|---|---|---|---|
| value | Array.<number> | Selected date range in milliseconds | [0, 0] | No |
| min | number | Minimum selectable date in milliseconds | 0 | No |
| max | number | Maximum selectable date in milliseconds | 2556028800000 | No |
| showTime | boolean | Add time selection feature | true | No |
| limitMin | number | Minimum time interval between start and end dates in milliseconds | No | |
| limitMax | number | Maximum time interval between start and end dates in milliseconds | No |
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure, 300 for cancel |
| msg | string | Response information |
| data | Object | Response data |
| data.resBeginDate | number | Selected start date |
| data.resEndDate | number | Selected end date |
import { dateRangePicker } from '@suplink/jssdk';
dateRangePicker().then((res) => console.log(res))
setNavigationBar
| Attribute | Type | Description | Default | Required |
|---|---|---|---|---|
| title | string | Navigation bar title | No | |
| backgroundColor | string | Navigation bar background color, supports only hexadecimal colors | #ffffff | No |
| backButton | boolean | Whether the back button is displayed | true | No |
| theme | string | Navigation bar theme, dark: dark theme | light: light theme | dark | No |
| goast | boolean | Whether the navigation bar is floating and transparent, true: navigation bar background color is #646464 with 50% opacity, and backgroundColor is invalid (effective for SUPOS pages) | false | No |
| hidden | boolean | Whether the navigation bar is hidden | false | No |
| atomicBond | boolean | Whether the atomic key in the upper right corner is displayed | true | No |
| underline | boolean | Whether the navigation bar underline is displayed | true | No |
theme and goast are unavailable for web apps.
| Attribute | Type | Description |
|---|---|---|
| code | string | Response code: 200 for success, 404 for failure |
| msg | string | Response information |
| data | unknown | Response data |
import { setNavigationBar } from '@suplink/jssdk';
setNavigationBar({ title: 'suplink' }).then((res) => console.log(res))